<include file="Public:header" />
<div class="content-box"><!-- Start Content Box -->
    <switch name="ACTION_NAME">
        <case value="edit">
            <div class="content-box-header">
                <h3>编辑分类</h3>
                <div class="clear"></div>
            </div> <!-- End .content-box-header -->
            <div class="content-box-content">

                <form name="catsform" method="post" action="__URL__/doedit">
                    <input type="hidden" name="id" value="{$cat_data.id}">
                    <p>
                        <label>选择父类</label>
                        <select name="fatherid" id="fatherid" class="small-input">
                            <volist name="categoty" id="data"  >
                                <option value="{$key}" <if condition="$key eq $cat_data.fatherid "> selected="selected" </if>>{$data}</option>
                            </volist>
                        </select>
                    </p>

                    <p>
                        <label>分类名</label>
                        <input type="text" name="name" id="small-input" class="text-input small-input" value="{$cat_data.name}" > <span class="input-notification success png_bg">Successful message</span>
                    </p>

                    <p>
                        <label>拼音</label>
                        <input type="text"  name="pinyin" value="{$cat_data.pinyin}" id="small-input" class="text-input small-input" >
                    </p>

                    <div align="center"><input class="button" type="submit" value="提交" /></div>
                </form>
            </div>


        </case>
        <default />


        <div class="content-box-header">

            <h3>{$title}</h3><h3>总共{$catecount}个分类</h3>

            <ul class="content-box-tabs">
                <li><a href="#tab1" class="default-tab">列表</a></li>
                <li><a href="#tab2">添加</a></li>
            </ul>

            <div class="clear"></div>

        </div> <!-- End .content-box-header -->

        <div class="content-box-content">

            <div class="tab-content default-tab" id="tab1">
                <form name="proform" method="post" action="__URL__/batch">
                    <table>

                        <thead>
                            <tr>
                                <th><input class="check-all" type="checkbox" /></th>

                                <th>分类名</th>
                                <th>拼音</th>
                                <th>父id</th>
                                <th>排序</th>
                                <th>操作</th>
                            </tr>
                        </thead>

                        <tbody>
                        <volist name="categoty" id="data">
                            <if condition="$data.id neq '' ">
                                <tr align='center'>
                                    <td><input name="id[]" type="checkbox" value="{$data.id}"  /></td>
                                    <td><a href='__URL__/edit/id/{$data.id}'><u>{$data.name}</u></a></td>
                                    <td><a href='__URL__/edit/id/{$data.id}'><u>{$data.pinyin}</u></a></td>
                                    <td>{$data.fatherid}</td>
                                    <td><input size ="3" name="{$data.id}" value="{$data.orderid}" /></td>
                                    <td>
                                        <a href="__URL__/edit/id/{$data.id}" title="Edit">编辑</a>
                                        <a href="__URL__/batch/act/delete/id/{$data.id}" title="Delete">删除</a>
                                    </td>
                                </tr>
                            </if>
                        </volist>

                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="6">
                                    <div class="bulk-actions align-left">
                                        <select name="act">
                                            <option value="pinyin">生成拼音</option>
                                            <option value="delete">删除</option>
                                            <option value="editeorder">编辑排序</option>
                                        </select><input  class="button" type="submit" value="确定"  />

                                    </div>

                                    <div class="clear"></div>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </form>
            </div>
            
            <div class="tab-content" id="tab2">
                <script type="text/javascript" src="__ROOT__/Public/Js/addInput.js"></script>
                <script type="text/javascript">
                    $(function(){
                        $("#addname").addinput({name: ["name"]});
                    });
                </script>
                            <form name="catsform" id ="catsform" method="post" action="__URL__/doadd">

                                <fieldset>

                                        <span style="float:left">
                                        <label>父类</label>
                                        <select  multiple="multiple" name="fatherid" style="height:400px">
                                            <volist name="cateOption" id="data"  >
                                                <option value="{$key}">{$data}</option>
                                            </volist>
                                        </select>
                                        </span>
                                        <span style="float:right">
                                        <label>分类名</label>
                                        <input class="text-input small-input" type="text" id="small-input" name="small-input" />
                                        <ul id="addname"></ul><a href="#">+ 添加</a>
                                        <input class="button" type="submit" value="Submit" />
                                        </span>

                                </fieldset>

                                <div class="clear"></div><!-- End .clear -->

                            </form>

                        </div> <!-- End #tab2 -->
        </div> <!-- End .content-box-content -->
    </switch>
</div> <!-- End .content-box -->
<include file="Public:footer" />
